﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class Admin_MySet : OTS.AdminBasePage 
{
    protected void Page_Load(object sender, EventArgs e)
    {
        this.TestLogin(HttpContext.Current);
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        string strOldPsd = this.oldPw.Text;
        string strNewPsd = this.newPw.Text;
        string strNewPsd_c = this.newPw_c.Text;
        if ("" == strNewPsd)
        {
            OTS.Common.Jscript.Alert("新密码输入不能为空");
            return;
        }
        if (strNewPsd != strNewPsd_c)
        {
            OTS.Common.Jscript.Alert("两次输入的密码不一致");
            return;
        }
        OTS.BLL.SysUserBLL bll = new OTS.BLL.SysUserBLL();
       OTS.Model.SessionUser sUser = getSessionUser(HttpContext.Current);
       if (bll.ChangePassword(sUser.uid, strOldPsd, strNewPsd))
       {
           this.oldPw.Text = "";
           this.newPw.Text = "";
           this.newPw_c.Text = "";
           OTS.Common.Jscript.Alert("密码修改成功！");
           return;
       }
       else
       {
           OTS.Common.Jscript.Alert("密码修改失败！");
           return;
       }
    }
}
